package com.plian.system.wrapper.hr.hrbackup;

import com.plian.system.dto.hr.staff.WorkExperienceDTO;
import com.plian.system.dto.hr.staffBackup.WorkExperienceOldDTO;
import com.plian.system.entity.hr.staff.WorkExperience;
import com.plian.system.entity.hr.staffAnnualBackup.WorkExperienceOld;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.hr.staff.WorkExperienceVO;
import com.plian.system.vo.hr.staffAnnualBackup.WorkExperienceOldVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.SPRING;
import static com.plian.system.wrapper.util.WrapperConstant.STR_NULL_TO_EMPTY;

/**
 * 工作经历包装类,返回视图层所需的字段
 *
 * @author gangan
 * @since 2019-09-30
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface WorkExperienceOldWrapper extends BaseWrapper<WorkExperienceOld, WorkExperienceOldDTO, WorkExperienceOldVO> {

	@Override
	@Mappings(value = {
			@Mapping(source = "jobNameId", target = "jobNameId", qualifiedByName = STR_NULL_TO_EMPTY),
			@Mapping(source = "jobNameId", target = "jobNameName", defaultValue = ""),
	})
	WorkExperienceOldVO entityToVO(WorkExperienceOld entity);
}
